/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package technotheist.data.wrap;

import technotheist.data.BBuffer;

/**
 *
 * @author Mitch
 */
public class BShortMapBuffer<M extends BBuffer.Mappable> extends BBuffer<M> {
    private final BBuffer<Short> parent;
    private final M[] map;

    public BShortMapBuffer(BBuffer<Short> parent, M[] map) {
	this.parent = parent;
	this.map = map;
    }

    @Override
    public Class<?> primType() {
	return map[0].getClass();
    }

    @Override
    public int size() {
	return parent.size();
    }

    @Override
    public M s(int index) {
	return map[parent.s(index)];
    }

    @Override
    public void s(int index, M v) {
	parent.s(index, (short) v.ordinal());
    }
    
}
